<?php
namespace app\admin\controller;

use think\Controller;
use app\admin\service\InstrumentService;

class Instrument extends Controller
{
    private $instrumentService;

    /**
     * 依赖注入 Service
     *
     * @param InstrumentService $instrumentService
     * @author zws
     */
    public function __construct(InstrumentService $instrumentService)
    {
        $this->instrumentService = $instrumentService;
        parent::__construct();
    }

    /**
     * 检测仪器列表
     * @return \think\response\Json
     * @author zws
     */
    public function index()
    {
        $input = $this->request->input;
        $result = $this->instrumentService->index($input);
        return app_response(200, $result);
    }

    /**
     * 获取单个仪器信息
     * @return \think\response\Json
     * @author zws
     */

    public function edit(){
        $input = $this->request->input;
        $result = $this->instrumentService->edit($input);
        return app_response(200, $result);
    }

    /**
     * 编辑仪器信息
     * @return \think\response\Json
     * @author zws
     */
    public function update(){
        $input = $this->request->input;
        $result = $this->instrumentService->update($input);
        return app_response(200, $result ? '编辑成功' : '编辑失败');
    }


}